import java.util.StringTokenizer;


class P11559_39643 {

	public static void main(String[] args) {
		String line = readLn();
		
		while (line != null) {
			StringTokenizer st = new StringTokenizer(line);
			int n = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			int h = Integer.parseInt(st.nextToken());
			int w = Integer.parseInt(st.nextToken());
			
			int[][] hotels = new int[h][];
			int[] hotelsCost = new int[h];
			
			for (int k = 0; k < h; k++) {
				hotelsCost[k] = Integer.parseInt(readLn());
				int[] a = new int[w];
				st = new StringTokenizer(readLn());
				
				for (int j = 0; j < w; j++) {
					a[j] = Integer.parseInt(st.nextToken());
				}
				
				hotels[k] = a;
			}
			
			int minCost = Integer.MAX_VALUE;
//			boolean stayHome = false;
			for (int k = 0; k < w; k++) {
//				int minPerWeek = Integer.MAX_VALUE; // more than p
				
				for (int j = 0; j < h; j++) {
					if (n <= hotels[j][k] && n * hotelsCost[j] <= b) {
						if (minCost > (n * hotelsCost[j])) {
							minCost = n * hotelsCost[j];
						}
					}
				}
				
			}
			
			if (minCost ==  Integer.MAX_VALUE)
				System.out.println("stay home");
			else System.out.println(minCost);
			
			line = readLn();
		}
		
	}
	
	static String readLn() {
        String newLine = System.getProperty("line.separator");
        StringBuffer buffer = new StringBuffer();
        int car = -1;
        try {
            car = System.in.read();
            while ((car > 0) && (car != newLine.charAt(0))) {
                buffer.append((char)car);
                car = System.in.read();
            }
            if (car == newLine.charAt(0))
            System.in.skip(newLine.length() - 1);
        } catch (java.io.IOException e) { return (null);}
        if ((car < 0) && (buffer.length() == 0)) return (null);
        return buffer.toString();
    }
	
}
